namespace Xmef.Engine.Internal
{
    using System;
    using Xmef.Engine;
    using Xmef.Interfaces;
    using Xmef.Library;

    [Serializable]
    internal class PluginConfiguration : PluginIdentity, IXmlPluginConfigurationInternal, IContainer<IXmlPluginConfiguration>
    {
        private PluginConfigurationManager _configuration;
        private readonly string _fileName;
        private readonly string _hostName;
        private readonly bool _isDefault;

        public PluginConfiguration()
        {
            this._configuration = new PluginConfigurationManager();
        }

        public PluginConfiguration(string hostName, string fileName, bool isDefault)
        {
            this._configuration = new PluginConfigurationManager();
            this._hostName = hostName;
            this._fileName = fileName;
            this._isDefault = isDefault;
        }

        bool IContainer<IXmlPluginConfiguration>.Add(IXmlPluginConfiguration plugin)
        {
            return this._configuration.Add(plugin);
        }

        bool IContainer<IXmlPluginConfiguration>.Contains(IXmlPluginConfiguration value)
        {
            return this._configuration.Contains(value);
        }

        bool IContainer<IXmlPluginConfiguration>.Remove(IXmlPluginConfiguration plugin)
        {
            return this._configuration.Remove(plugin);
        }

        public IPluginConfigurationManager ConfigurationManager
        {
            get
            {
                return this._configuration;
            }
        }

        public string FileName
        {
            get
            {
                return this._fileName;
            }
        }

        public string HostName
        {
            get
            {
                return this._hostName;
            }
        }

        public bool IsDefault
        {
            get
            {
                return this._isDefault;
            }
        }

        IPluginConfigurationManagerInternal IXmlPluginConfigurationInternal.InternalConfigurationManager
        {
            get
            {
                return this._configuration;
            }
        }

        int IContainer<IXmlPluginConfiguration>.Count
        {
            get
            {
                return this._configuration.Count;
            }
        }
    }
}

